<?php
class BuildingRotateAction extends SzAbstractAction
{
    protected $paramTypes = array(
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_ARRAY,
        SzAbstractAction::TYPE_ARRAY,
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_INT
    );

    /**
     * Rotate a decoration.
     *
     * @param int $userId
     * @param array $gridIds
     * @param array $blockIds
     * @param int $girdLayer
     * @param int $orient
     * @return SzResponse
     */
    public function execute($userId, $gridIds, $blockIds, $girdLayer, $orient)
    {
        /** @var GroundVo $ground */
        list($ground) = BuildingService::get()->rotate($userId, $gridIds, $blockIds, $girdLayer, $orient);
        return $this->buildResponse(array(
            'ground' => $ground->toArray()
        ));
    }
}